<%@ page import="com.vshining.grame.Menu" %>



<div class="fieldcontain ${hasErrors(bean: menuInstance, field: 'name', 'error')} required">
	<label for="name">
		<g:message code="menu.name.label" default="Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="name" pattern="${menuInstance.constraints.name.matches}" required="" value="${menuInstance?.name}"/>

</div>

<div class="fieldcontain ${hasErrors(bean: menuInstance, field: 'level', 'error')} required">
	<label for="level">
		<g:message code="menu.level.label" default="Level" />
		<span class="required-indicator">*</span>
	</label>
	<g:select name="level" from="${1..10}" class="range" required="" value="${fieldValue(bean: menuInstance, field: 'level')}"/>

</div>

<div class="fieldcontain ${hasErrors(bean: menuInstance, field: 'target', 'error')} ">
	<label for="target">
		<g:message code="menu.target.label" default="Target" />
		
	</label>
	<g:textField name="target" value="${menuInstance?.target}"/>

</div>

<div class="fieldcontain ${hasErrors(bean: menuInstance, field: 'preMenu', 'error')} ">
	<label for="preMenu">
		<g:message code="menu.preMenu.label" default="Pre Menu" />
		
	</label>
	<g:select id="preMenu" name="preMenu.id" from="${com.vshining.grame.Menu.list()}" optionKey="id" value="${menuInstance?.preMenu?.id}" class="many-to-one" noSelection="['null': '']"/>

</div>

<div class="fieldcontain ${hasErrors(bean: menuInstance, field: 'subMenus', 'error')} ">
	<label for="subMenus">
		<g:message code="menu.subMenus.label" default="Sub Menus" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${menuInstance?.subMenus?}" var="s">
    <li><g:link controller="menu" action="show" id="${s.id}">${s?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="menu" action="create" params="['menu.id': menuInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'menu.label', default: 'Menu')])}</g:link>
</li>
</ul>


</div>

<div class="fieldcontain ${hasErrors(bean: menuInstance, field: 'index', 'error')} required">
	<label for="index">
		<g:message code="menu.index.label" default="Index" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="index" type="number" value="${menuInstance.index}" required=""/>

</div>

